package com.muyu.system.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author Administrator
 */

@Getter
@AllArgsConstructor
public enum ChangeTypeEnum {

    RECHARGE(1, "充值"),
    REFUND(2, "退款");

    @EnumValue
    @JsonValue
    private final int code;

    private final String name;

    @JsonCreator
    public static ChangeTypeEnum getChangeTypeEnum(int code) {
        for (ChangeTypeEnum value : ChangeTypeEnum.values()) {
            if (value.code == code) {
                return value;
            }
        }
        return null;
    }
}
